home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 19 / CD_ASCQ_19_010295.iso / dos / prg / pas / swag / color.swg / 0006_Get VGA Palette.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  61 lines

  1. {
  2. >A VGA's screen values can be found by defining something like:
  3.  
  4. >   VGAScreen : Array[1..64000] of Byte Absolute $A000:0000
  5.  
  6. >But, how do I find out exactly what color #200 is? It must be held in memory
  7. >some place. Can anyone supply a Procedure, Function or some
  8.  
  9. I've written this short Program quite a While ago For some testing,
  10. it should compile and work ok. Just note that it Uses slow BIOS
  11. Function, it's not a good choice For fast palette animations but
  12. otherwise works fine.
  13. }
  14.  
  15. Program Palette256;
  16. Uses Dos;
  17.  
  18. Type
  19.   VGAColour = Record
  20.     RByte, GByte, BByte : Byte;
  21.   end;
  22.  
  23.   VGAPal = Array[0..$FF] of VGAColour;
  24.  
  25. Var
  26.   Palette : VGAPal;
  27.   i : Byte;
  28.  
  29. Procedure GetVGAPal(Var Pal : VGAPal);
  30. Var
  31.   CPUregs : Registers;
  32. begin
  33. with CPUregs do
  34.   begin
  35.   ax:=$1017;
  36.   bx:=$00;
  37.   cx:=$100;
  38.   es:=Seg(Pal);
  39.   dx:=Ofs(Pal);
  40.   end;
  41.   Intr($10,CPUregs);
  42. end; {GetVGAPal}
  43.  
  44. Procedure SVMode(vmod : Byte);
  45. Var
  46.   CPUregs : Registers;
  47. begin
  48. CPUregs.ah:=0;
  49. CPUregs.al:=vmod;
  50. Intr($10,CPUregs);
  51. end; {SVMode}
  52.  
  53. begin
  54. SVMode($13);
  55. GetVGAPal(Palette);
  56. SVMode($02);
  57. for i:=0 to $FF do
  58.   Writeln('Entry ',i:3,' Red : ',Palette[i].RByte:3,' Green : ',
  59.            Palette[i].GByte:3,' Blue : ',Palette[i].BByte:3);
  60. end.
  61.